/**
 * 
 * 单例模式
 */
let Singleton = function (params) {
    this.params=params
}


Singleton.getInstance = function (params) {
    return this.instance|| (this.instance=new Singleton(params))
}

let res1 = Singleton.getInstance('Winner');
let res2 = Singleton.getInstance('Looser');

console.log(res1) // Singleton { params: 'Winner' } 
console.log(res2) // Singleton { params: 'Winner' } 
console.log(res1===res2) // true